package com.ruoyi.web.controller.applet;


import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.BdmOrder;
import com.ruoyi.system.service.IBdmPayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

@RestController
@RequestMapping("/applet/AppletPay")
public class AppletPayController {


    @Autowired
    private IBdmPayService iBdmPayService;


    /**
     * 是否设置余额支付密码
     */
    @GetMapping("/ifSetBalancePayCode")
    public AjaxResult ifSetBalancePayCode(){
        return AjaxResult.success(iBdmPayService.ifSetBalancePayCode());
    }


    /**
     * 小程序拉起支付
     */
     @PostMapping("/appPay")
    public Map<String, Object> appPay(@RequestBody BdmOrder bdmOrder){
        return iBdmPayService.appPay(bdmOrder);
     }

    /**
     * 小程序支付回调
     */
    @PostMapping("/payNotify")
    public  String payNotify(HttpServletRequest request, HttpServletResponse response)
    {
        return iBdmPayService.payNotify(request,response);
    }



}
